forum

home / developersection / forums / hover on getelementbyid using javascript

Hover on getElementById using javascript

Anonymous User 3248 19-Aug-2013
Hi!

I hope someone can answer my question, it is probably easy for you but I am not very used to JavaScript.

So I made a menu using this code:

function tabSwitch(new_tab, new_content) { 
    document.getElementById('content_1').style.display = 'none'; 
    document.getElementById('content_2').style.display = 'none'; 
    document.getElementById('content_3').style.display = 'none';         
    document.getElementById(new_content).style.display = 'block';    
    document.getElementById('tab_1').className = ''; 
    document.getElementById('tab_2').className = ''; 
    document.getElementById('tab_3').className = '';         
    document.getElementById(new_tab).className = 'active';     
}

When clicking on the area of tab_1 the content_1 is displayed and so on. But I would like to get the content displayed when the mouse hovers over the area of the different tabs. Could you please help me, I looked up the web but I could not find anything, maybe because I have actually no idea of JavaScript.

So, thanks for your time and help.


Updated on 19-Aug-2013

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By